package com.sync.syncmasterdata.product.repository.BPM;

import com.sync.syncmasterdata.product.entity.BPM.InventoryLdtDeleteEntity;
import com.sync.syncmasterdata.product.entity.BPM.InventoryForItemSheetEntity;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface SelectLdtItemSheet extends JpaRepository<InventoryForItemSheetEntity,String> {
    /**
     * 通过主表id获取明细中产品信息
     * @param id 主表id
     * @return 返回查询到的产品信息
     */
    @Query(nativeQuery = true, value= "SELECT lif.update_type,lif.if_jc_exist,lis.id,lis.item_code,lis.warehouse_location,lis.business_type,lis.product_group,lis.brand,lis.product_name,lis.item_name_id,lis.inventory_code_txt,lis.erp_id,lis.product_line,lis.item_name_txt,lis.product_type_id,lis.crm_id FROM i0622_ldt_item_flow lif LEFT JOIN i0622_ldt_item_sheet lis ON lif.id = lis.parentId where lis.parentId=:id")
    List<InventoryForItemSheetEntity> getProductInformation(@Param(value = "id") String id);

}
